<?php $this->headLink()
->appendStylesheet($this->Css('button.css'))
->appendStylesheet($this->js('css/jquery.alerts.css'))
?>
<?php $this->headScript()
->appendFile($this->js('plugins/jquery.form.js'))
->appendFile($this->js('plugins/jquery.blockUI.js'))
->appendFile($this->js('plugins/jquery.alerts.js'))
->captureStart()?>
$(document).ready(function(){
	$("#student_sn").change(function(){
	 	//$.cookie('Student_Sn',null);
	 	var sn = $(this).val();
		$.cookies.set("Student_Sn",sn);
		getdata(sn);
		});

	$("#save-button").click(function(){
		$('#main_body').block({message:'<h1><?php echo $this->translate('Data setting ..')?></h1>',  border: '3px solid #f00'});
		var sn = $("#student_sn").val();
		$("#parentsM-student_sn").attr('value',sn);
		$("#parentsF-student_sn").attr('value',sn);
		$("#guardian-student_sn").attr('value',sn);
		$("#grandparentsM-student_sn").attr('value',sn);
		$("#grandparentsF-student_sn").attr('value',sn);
		$("#setForm").submit();
	});

	var sn = setStudent();
	 getdata(sn);
});

function getdata(sn) {
	var cc = $("#student_sn option").length;
	if (cc==0) {
			$("#student_sn").hide();
			alert('<?php echo $this->translate('none data')?>');
			$(".rightArea input").attr('disabled','disabled');
			return false;
		}
		$.get('<?php echo $this->route('getdata')?>',{sn:sn},function(data){
			$("#showdata").html(data);
		});
	};
<?php $this->headScript()->captureEnd()?>
<style>
.ui-widget-content {font-size:13px; margin:5px}
</style>
<div id="main_body">

<div class="leftArea">
<?php echo $this->render('student.phtml')?>

<a id="save-button" class="fg-button ui-state-default fg-button-icon-left ui-corner-all" >
<span class="ui-icon ui-icon-disk" ></span>
<?php echo $this->translate('save')?>
</a>
<p style="clear:both">
<input type="checkbox" id="next_student"  value="1" ><label for="next_student"><?php echo $this->translate('next student')?></label>
</p>
</div>
<div class="rightArea">
<div id="showdata">
</div>
</div>
<div style="clear:both"></div>
</div>
